package com.doubao.device.controller;

import com.doubao.common.result.Result;
import com.doubao.device.dto.VoiceConfigDTO;
import com.doubao.device.service.DeviceVoiceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 智能体语音配置控制器
 */
@RestController
@RequestMapping("/device/voice")
@RequiredArgsConstructor
@Slf4j
@Tag(name = "智能体语音配置", description = "智能体语音配置相关接口")
public class VoiceConfigController {

    private final DeviceVoiceService voiceService;

    /**
     * 获取智能体语音配置
     */
    @GetMapping("/{deviceId}")
    @Operation(summary = "获取智能体语音配置", description = "获取指定智能体的语音配置")
    public Result<VoiceConfigDTO> getDeviceVoiceConfig(
            @Parameter(description = "智能体ID") @PathVariable Long deviceId) {
        return voiceService.getDeviceVoiceConfig(deviceId);
    }

    /**
     * 更新智能体语音配置
     */
    @PutMapping("/{deviceId}")
    @Operation(summary = "更新智能体语音配置", description = "更新指定智能体的语音配置")
    public Result<Void> updateDeviceVoiceConfig(
            @Parameter(description = "智能体ID") @PathVariable Long deviceId,
            @RequestBody VoiceConfigDTO voiceConfig) {
        return voiceService.updateDeviceVoiceConfig(deviceId, voiceConfig);
    }

    /**
     * 获取可用语音类型列表
     */
    @GetMapping("/types")
    @Operation(summary = "获取可用语音类型列表", description = "获取系统中所有可用的语音类型")
    public Result<List<VoiceConfigDTO>> getAvailableVoiceTypes() {
        return voiceService.getAvailableVoiceTypes();
    }
}